package mapReduce.demo06_sort.demo01_yearTemp;

import mapReduce.util.JobSubmit;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.partition.InputSampler;
import org.apache.hadoop.mapreduce.lib.partition.TotalOrderPartitioner;

import java.io.IOException;

public class YearTempApp {

    public static class YTMapper extends Mapper<Text, Text,Text,Text>{

//        Text outKey = new Text();
//        Text outValue = new Text();

        @Override
        protected void map(Text key, Text value, Mapper<Text, Text, Text, Text>.Context context) throws IOException, InterruptedException {

//            String line = value.toString();
//            String[] fields = line.split("\t");
//
//            outKey.set(fields[0]);
//            outValue.set(fields[1]);

            context.write(key,value);
        }
    }

    public static class YTReducer extends Reducer<Text,Text,Text,Text>{
        @Override
        protected void reduce(Text key, Iterable<Text> values, Reducer<Text, Text, Text, Text>.Context context) throws IOException, InterruptedException {
            super.reduce(key, values, context);
        }
    }

    public static void main(String[] args) throws Exception {
//        JobSubmit.submitJobByCriticalPoint(
//                YearTempApp.class,
//                args,
//                true,
//                new Object[]{0.8,2000,1},
//                4
//        );

        JobSubmit.submitJobByCriticalPoint(
                YearTempApp.class,
                args,
                true,
                "",
                4
        );
    }

}
